//
//  WechatRegisterApi.m
//  HerconWaterFilter
//
//  Created by Kendama on 2017/5/8.
//  Copyright © 2017年 JianWei Chen. All rights reserved.
//

#import "WechatRegisterApi.h"

@implementation WechatRegisterApi{
    NSDictionary *_dic;
}

-(id)initWithDic:(NSDictionary *)dic{
    if (self = [super init]) {
        _dic = dic;
    }
    return self;
}

- (NSString *)requestUrl {
    return @"/new/user/wx_register";
}

- (YTKRequestMethod)requestMethod {
    return YTKRequestMethodPOST;
}

- (id)requestArgument {
    NSMutableDictionary *dic = [NSMutableDictionary getPubdicGuest];
    if (_dic[@"username"]) {
        
        NSString* base64Text = [NSString encryptUseAES:_dic[@"username"] key:nil];
        
        [dic setObject:base64Text forKey:@"username"];
        
    }
    
    if (_dic[@"unionid"]) {
        
        [dic setObject:_dic[@"unionid"] forKey:@"unionid"];
    }
    
    if (_dic[@"vcode"]) {
        [dic setObject:_dic[@"vcode"] forKey:@"vcode"];
        
    }
    NSString *sign=[NSString getSign:dic];
    [dic setObject:sign forKey:@"sign"];
    return dic;
    
    
}

- (NSString *)userId {
    return [[[self responseJSONObject] objectForKey:@"userId"] stringValue];
}


-(void)dealloc
{
    NSLog(@"RegisterApi dealloc");
}

@end
